{* Модуль блока фильтров списка клиентов *}

<script type="text/javascript">
<!--{literal}
$(document).ready
(
    function()
    {
	$('select#filter').change
	(
	    function()
	    {
		$.blockUI({message:'Подождите...'});
		setTimeout(function(){$.unblockUI()},2000);
	    }
	);

	$('input#customer-name').autocomplete
	({
	    source:	'json/getDictionary.php?dictionary=customers',
	    delay:	0,
	    select:	function(event,ui){$(this).val($(ui.item).val());$('form#customer-search').submit();}
	});

	$('input:checkbox.search-option').click(function(){$('form#customer-search').submit();});
	$('select#filter-print').change(function(){$('form#customer-search').submit();});
	$('a#q-clean').click(function(){$('#customer-name').val('');});
    }
);
{/literal}-->
</script>

<!-- НАЧАЛО блока фильтров -->
<form method="get" id="customer-search">
    <input type="hidden" name="do" value="filter"/>
    <table class="ui-widget ui-state-default ui-corner-all" >
	<tr>
	    <th class="ui-widget-header" colspan="4">Блок фильтров</th>
	</tr>
	<tr>
	    <td align="right">Поиск:</td>
	    <td colspan="2"><input type="text" name="q" class="search" value="{$smarty.session.filter.customer_list.q|sslash|escape}" id="customer-name" style="width: 95%;"/><a href="javascript:void(0)" id="q-clean"><img src="images/icons/delete_16.png" border="0"/></a></td>
	</tr>
	<tr>
	    <td align="right">Номер договора:</td>
	    <td><input type="text" name="contract_num" class="search" value="{$smarty.session.filter.customer_list.contract_num|sslash|escape}" id="contract-num" style="width: 90%;"/><a href="javascript:void(0)" id="contract-clean"><img src="images/icons/delete_16.png" border="0"/></a></td>
	    <td>&nbsp;</td>
	</tr>
	{if $smarty.session.manager.is_admin==1}
	<tr>
	    <td align="right">Менеджер:</td>
	    <td colspan="2">
		<select name="manager_id">
		    <option value="">&mdash;</option>
		    {foreach from=$managers item=manager}
		    <option value="{$manager.id}" {if $smarty.session.filter.customer_list.manager_id==$manager.id}selected{/if}>{$manager.manager_name}</option>
		    {/foreach}
		</select>
	    </td>
	</tr>
	{/if}
	<tr>
	    <td align="right">Группа:</td>
	    <td colspan="2">
		<select name="group_id">
		    <option value="">&mdash;</option>
		    {foreach from=$groups item=group}
		    <option value="{$group.id}" {if $smarty.session.filter.customer_list.group_id==$group.id}selected{/if}>{$group.group_name}</option>
		    {/foreach}
		</select>
	    </td>
	</tr>
	<tr>
	    <td align="right">Статус:</td>
	    <td>
		<select name="status_id">
		    <option value="">&mdash;</option>
		    {foreach from=$statuss item=status}
		    <option value="{$status.id}" {if $smarty.session.filter.customer_list.status_id==$status.id}selected{/if}>{$status.status_name}</option>
		    {/foreach}
		</select>
	    </td>
	    <td>
		<select name="documents" id="filter-print">
		    <option value="">&mdash;</option>
		    <option value="complete" {if $smarty.session.filter.customer_list.documents=='complete'}selected{/if} class="ui-state-highlight">Документы загружены</option>
		    <option value="no-complete" {if $smarty.session.filter.customer_list.documents=='no-complete'}selected{/if} class="ui-state-error">Документы не загружены</option>
		    <option value="printed" {if $smarty.session.filter.customer_list.documents=='printed'}selected{/if} class="ui-state-default">Документы распечатаны</option>
		    <option value="no-printed" {if $smarty.session.filter.customer_list.documents=='no-printed'}selected{/if} class="ui-state-disabled">Документы не распечатаны</option>
		</select>
	    </td>
	</tr>
	<tr>
	    <td colspan="3" align="center">
		<input type="submit" class="button" value="Применить фильтр"/>
	    </td>
	</tr>
    </table>
</form>
<!-- КОНЕЦ блока фильтров -->
